package com.spring.utils.api_v4.dao;

import com.spring.utils.api_v4.pojo.Password;
import com.spring.utils.api_v4.pojo.UserInfo;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

import javax.transaction.Transactional;

@Repository
public interface IPwdDao extends JpaRepository<Password, UserInfo> {
    /**
     * 获取用户密码
     * @param userId
     * @return
     */
    Password findByUserInfoId(String userId);

    /**
     * 根据账号获取密码
     * @param userInfo
     * @return
     */
    Password findByUserInfo(UserInfo userInfo);

    /**
     * 删除用户的密码信息
     * @param userInfo
     */
    @Transactional
    void deleteByUserInfo(UserInfo userInfo);
}
